﻿<controls:Flyout x:Class="SoftTeach.View.Noten.MetroNoteEintragenFlyout"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                 mc:Ignorable="d" 
                 d:DesignHeight="300" 
                 d:DesignWidth="800"
                 Position="Bottom"
                 FontSize="18"
                 Theme="Light"
                 x:Name="NotenFlyout"
                 MouseLeave="MetroNoteEintragenFlyout_OnMouseLeave" Background="Gainsboro" Opacity="0.9">
  <controls:Flyout.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SoftTeach;component/Resources/MetroResources.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatSlider.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Themes/Dialogs/BaseMetroDialog.xaml" />
        <ResourceDictionary >
          <!-- Defines a RadioButton style. -->
          <Style TargetType="{x:Type RadioButton}" x:Key="MetroNotenClickButton">
            <Setter Property="SnapsToDevicePixels" Value="true" />
            <Setter Property="OverridesDefaultStyle" Value="true" />
            <Setter Property="Width" Value="80"/>
            <Setter Property="Height" Value="80"/>
            <Setter Property="Margin" Value="2"/>
            <Setter Property="FontSize" Value="55" ></Setter>
            <Setter Property="Template">
              <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                  <BulletDecorator Background="Transparent">
                    <BulletDecorator.Bullet>
                      <Grid x:Name="ParentGrid" Background="White">
                        <Border x:Name="CheckMark" Margin="1">
                          <Border.Background>
                            <SolidColorBrush Color="White"/>
                          </Border.Background>
                          <ContentPresenter Width="30" Height="{Binding ElementName=ParentGrid, Path=ActualHeight}"
                                      Margin="25,0"
                                      RecognizesAccessKey="True" />
                        </Border>
                      </Grid>
                    </BulletDecorator.Bullet>
                    <VisualStateManager.VisualStateGroups>
                      <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal" />
                        <VisualState x:Name="MouseOver">
                          <Storyboard>
                            <ColorAnimation Duration="0:0:0.10" Storyboard.TargetName="ParentGrid" Storyboard.TargetProperty="Background.Color" To="LightGray"/>
                          </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Pressed">
                          <Storyboard>
                            <ColorAnimation Duration="0:0:0.10" Storyboard.TargetName="CheckMark" Storyboard.TargetProperty="Background.Color" To="LightGreen"/>
                          </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Disabled">
                          <Storyboard>
                            <ColorAnimation Duration="0:0:0.10" Storyboard.TargetName="CheckMark" Storyboard.TargetProperty="Background.Color" To="LightGray"/>
                          </Storyboard>
                        </VisualState>
                      </VisualStateGroup>
                      <VisualStateGroup x:Name="CheckStates">
                        <VisualState x:Name="Checked">
                          <Storyboard>
                            <ColorAnimation  Duration="0:0:0.10" Storyboard.TargetName="CheckMark" Storyboard.TargetProperty="Background.Color" To="LightGreen"/>
                          </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Unchecked">
                          <Storyboard>
                            <ColorAnimation Duration="0:0:0.10" Storyboard.TargetName="CheckMark" Storyboard.TargetProperty="Background.Color" To="White"/>
                          </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Indeterminate" />
                      </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                  </BulletDecorator>
                </ControlTemplate>
              </Setter.Value>
            </Setter>
          </Style>
        </ResourceDictionary>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </controls:Flyout.Resources>
  <!--<controls:Flyout.Triggers>-->
    <!--<Trigger SourceName="OkButton" Property="Button.IsPressed" Value="True">
      <Setter TargetName="NotenFlyout" Property="controls:Flyout.IsOpen" Value="False"/>
    </Trigger>-->
    <!--<EventTrigger RoutedEvent="Button.Click" SourceName="OkButton">
      <BeginStoryboard Name="FlyoutStoryboard">
        <Storyboard>
          <BooleanAnimationUsingKeyFrames Storyboard.TargetName="NotenFlyout" Storyboard.TargetProperty="IsOpen">
            <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
          </BooleanAnimationUsingKeyFrames>
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>-->
    <!--<EventTrigger RoutedEvent="Button.LostFocus" SourceName="OkButton">
      <StopStoryboard BeginStoryboardName="FlyoutStoryboard"/>
    </EventTrigger>-->
  <!--</controls:Flyout.Triggers>-->
  <Grid Margin="30">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto"/>
      <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Center">
      <Label Style="{StaticResource MetroLabelStyle}" Content="Note geben für"/>
      <Label Style="{StaticResource MetroLabelStyle}" Content="{Binding Path=SchülereintragPerson.PersonVorname}"/>
      <Label Style="{StaticResource MetroLabelStyle}" Content="{Binding Path=SchülereintragPerson.PersonNachname}"/>
    </StackPanel>
    <Label Style="{StaticResource MetroLabelStyle}" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="10">Qualität</Label>
    <UniformGrid Grid.Row="1" Grid.Column="1" Margin="0" Rows="1" Columns="6">
      <RadioButton Name="Qualität1Radio" Command="{Binding Path=Qualität1Command}" Style="{StaticResource MetroNotenClickButton}" Content="1"/>
      <RadioButton Name="Qualität2Radio" Command="{Binding Path=Qualität2Command}" Style="{StaticResource MetroNotenClickButton}" Content="2"/>
      <RadioButton Name="Qualität3Radio" Command="{Binding Path=Qualität3Command}" Style="{StaticResource MetroNotenClickButton}" Content="3"/>
      <RadioButton Name="Qualität4Radio" Command="{Binding Path=Qualität4Command}" Style="{StaticResource MetroNotenClickButton}" Content="4"/>
      <RadioButton Name="Qualität5Radio" Command="{Binding Path=Qualität5Command}" Style="{StaticResource MetroNotenClickButton}" Content="5"/>
      <RadioButton Name="Qualität6Radio" Command="{Binding Path=Qualität6Command}" Style="{StaticResource MetroNotenClickButton}" Content="6"/>
    </UniformGrid>
    <Label Style="{StaticResource MetroLabelStyle}" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="10">Quantität</Label>
    <UniformGrid Grid.Row="2" Grid.Column="1" Margin="0" Rows="1" Columns="6">
      <RadioButton Name="Quantität1Radio" Command="{Binding Path=Quantität1Command}" Click="RadioOnClick" Style="{StaticResource MetroNotenClickButton}" Content="1"/>
      <RadioButton Name="Quantität2Radio" Command="{Binding Path=Quantität2Command}" Click="RadioOnClick" Style="{StaticResource MetroNotenClickButton}" Content="2"/>
      <RadioButton Name="Quantität3Radio" Command="{Binding Path=Quantität3Command}" Click="RadioOnClick" Style="{StaticResource MetroNotenClickButton}" Content="3"/>
      <RadioButton Name="Quantität4Radio" Command="{Binding Path=Quantität4Command}" Click="RadioOnClick" Style="{StaticResource MetroNotenClickButton}" Content="4"/>
      <RadioButton Name="Quantität5Radio" Command="{Binding Path=Quantität5Command}" Click="RadioOnClick" Style="{StaticResource MetroNotenClickButton}" Content="5"/>
      <RadioButton Name="Quantität6Radio" Command="{Binding Path=Quantität6Command}" Click="RadioOnClick" Style="{StaticResource MetroNotenClickButton}" Content="6"/>
    </UniformGrid>
    <!--<Button x:Name="OkButton" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" Background="LimeGreen" MinWidth="150" Margin="10" Command="{Binding NoteGegebenCommand}">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Qualität1Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Qualität2Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Qualität3Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Qualität4Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Qualität5Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Qualität6Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Quantität1Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Quantität2Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Quantität3Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Quantität4Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Quantität5Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
              <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Quantität6Radio" Storyboard.TargetProperty="(ToggleButton.IsChecked)">
                <DiscreteBooleanKeyFrame KeyTime="0" Value="False" />
              </BooleanAnimationUsingKeyFrames>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
       </Button.Triggers>
      <Label FontSize="50">Ok</Label>
    </Button>-->
  </Grid>
  <!--<controls:Flyout.Triggers>
    <Trigger SourceName="OkButton" Property="Button.IsPressed" Value="True">
      <Setter TargetName="NotenFlyout" Property="controls:Flyout.IsOpen" Value="False"/>
    </Trigger>
  </controls:Flyout.Triggers>-->
</controls:Flyout>
